# 该脚本用来执行编译expat.
# 路径全部使用windows风格的,unix风格,找不到.
#


# shell脚本windwos风格路径和unix风格都能识别.
# . C:\\03_SoftwareProjectHierachy\\04_my-lib\\05_shell\\JsShellUtility\\ga-log-manager\\GaLogManager.sh
. /c/03_SoftwareProjectHierachy/04_my-lib/05_shell/JsShellUtility/ga-log-manager/GaLogManager.sh
ga_debug aa bb cc

projectDir=`pwd -W`
inputRootDir=$projectDir/01_input
scriptRootDir=$projectDir/02_script
buildRootDir=$projectDir/03_build
outputRootDir=$projectDir/04_output
inputLibDir=$inputRootDir/wxWidgets-3.2.4/src/expat/expat
buildLibDir=$buildRootDir/expat
[[ ! -e $scriptRootDir ]] && mkdir $scriptRootDir
[[ ! -e $buildLibDir ]] && mkdir $buildLibDir
[[ ! -e $outputRootDir ]] && mkdir $outputRootDir
cd $buildRoot
flags=""
flags+=" --prefix=$outputRootDir"
# regex正则表达式模块编译有问题
# flags+="  --without-regex"
# flags+="  --without-libpng"
# flags+="  --without-libjpeg"
# flags+="  --without-libtiff"
# flags+="  --without-expat"
flags+=" --srcdir=$inputLibDir"

ga_verbose "" "flags is: ${flags}"



isConfigure="Y"
if [[ $isConfigure == "Y" ]]; then
    echo "configure..."
    rm -rf $buildLibDir && mkdir $buildLibDir && cd $buildLibDir
    $inputLibDir/configure $flags
    [[ $? != 0 ]] && configure failed && exit -1
fi
isMake="N"
if [[ $isMake == "Y" ]]; then
    cd $buildRootDir
    make
fi